const fs = require('fs')
let path = require('path')
let join = require('path').join

function getJsonFiles(jsonPath) {
  function findJsonFile(path) {
    const files = fs.readdirSync(path)
    files.forEach(item => {
      const fPath = join(path, item)
      const stat = fs.statSync(fPath)
      if (stat.isDirectory()) {
        findJsonFile(fPath)
      }
      if (stat.isFile()) {
        fs.writeFileSync(
          fPath,
          fs
            .readFileSync(fPath)
            .toString()
            .replace(/\sfill="black"/g, '')
            .replace(/\sfill="none"/g, '')
            .replace(/\swidth="16" height="16"/g, '')
        )
      }
    })
  }
  findJsonFile(jsonPath)
}

getJsonFiles(path.resolve(__dirname, './svg'))
